<template>
  <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
  <el-submenu index="1">
    <template slot="title">我的工作台</template>
    <el-menu-item index="2-1" @click="logout">退出登录</el-menu-item>
  </el-submenu>
</el-menu>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
    data: ()=>({
        activeIndex: "1"
    }),
    methods:{
        logout(){
            this.$confirm("您确定要退出登录吗？").then(()=>{
                this.$store.commit("logout");
                this.$message.success("已退出登录");
                this.$router.replace("/login");
            }).catch(()=>{})
        }
    }
})
</script>